home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / MAKEMRG.ZIP;1 / MAKEMRG.DOC < prev    next >
Encoding:
Text File  |  1993-03-07  |  11.8 KB  |  230 lines

  1.      Program: MAKEMRG.PRG  Version 1.0 (Initial Release)
  2.  
  3.       Author: Michael A. Huber
  4.               P.O. Box 501511
  5.               Indianapolis, IN  46250-6511
  6.  
  7.        Notes: Creates a WordPerfect 5.1 merge file (MERGE.DAT) using 
  8.               up to 64 fields from a dBASE IV database.  Also allows 
  9.               filtering of records, creating an index, convert the 
  10.               character fields to proper case and defining where
  11.               the output merge file will be located.
  12.  
  13. Requirements: WordPerfect 5.1 (Convert.Exe) - Trademark of WordPerfect Corp.
  14.               dBASE IV                      - Trademark of Borland
  15.  
  16. You may use this program and copy it freely among your friends or business 
  17. associates.  All I ask is that you do not remove this title screen from any
  18. copy you make and if you find the program useful send a donation of $10.00
  19. to me at the above address.  A User Defined Function called PROPER() is 
  20. located at the end of this program and is very useful even by itself.
  21.  
  22.  
  23.  
  24. BACKGROUND:
  25.       I was asked to correct a program recently which had been 
  26.       created specifically to maintain a database of distributors.
  27.       When I looked at this program I recognized that it lacked the 
  28.       flexibility to allow the user to easily create their own 
  29.       custom merge file.  I found that the user was not totally
  30.       familiar with dBASE or WordPerfect and was using an instruction
  31.       sheet that was obviously outdated and incorrect.  I also found 
  32.       that many people were manually maintaining and manipulating 
  33.       information to be used in merge files and had limited experience
  34.       in doing this, which meant that they struggled through the 
  35.       manuals for hours with limited success.
  36.             
  37.       This all spawned the idea that maybe I could create a program
  38.       that would allow the user to easily create a merge file and for
  39.       that user not to need a great deal of experience with database
  40.       files and merge file formats.
  41.             
  42.       This program is simple to use and does not require the user to
  43.       know anything about dBASE or WordPerfect other than how to start
  44.       this program (which could easily be accomplished with a menu
  45.       program) and how to create a merge document in Wordperfect.  The
  46.       program will become even more useful once the user understands
  47.       which dBASE IV logical operator to use to restrict the number of
  48.       records to be merged and what is the most logical index to
  49.       use.
  50.  
  51. INSTRUCTIONS:
  52.       Start the program from within dBASE at either the dot prompt or 
  53.       for God only knows, through the dreaded ASSIST screen.  The command
  54.       would be:
  55.       
  56.                        DO MAKEMRG
  57.       
  58.       At the "Database Filename Without Extension:" prompt, enter the name 
  59.       of any dBASE IV database.  Do not enter the file extension since it 
  60.       is assumed to be .DBF.  If the database is in another directory then 
  61.       make sure you include the path to that directory.
  62.  
  63. FIELD LIST:
  64.       Once you have entered the filename you will be presented with a screen
  65.       which shows the first 64 fields in the database.  Each field has a 
  66.       corresponding number which is used to create the field list.  When you
  67.       see the "Enter A Field Number:" prompt, enter the number of the field
  68.       that you want to be in your merge file.  Continue entering fields in 
  69.       this same way until you have completed the field list you want.  When
  70.       you are done press the ESC key to process the field list.
  71.       
  72.       WARNING:  A field list cannot contain more than 256 characters which
  73.       includes the necessary dBASE IV command language I have inserted.  I
  74.       didn't see any reason to increase the maximum string length since each
  75.       field name has a maximum of 10 characters, which means that you will 
  76.       have roughly 25 fields to choose from for your field list.
  77.             
  78. FILTER COMMAND:
  79.       After you have processed your field list you are presented with the 
  80.       "Filter Command:" prompt.  This allows you to set up a filter to
  81.       restrict the records for output to the merge file.  You must use
  82.       legitimate dBASE IV syntax for the filter command.  The following
  83.       logical operators are acceptable:
  84.       
  85.                   .and.  .not.  .or.  <  >  <>  =
  86.       
  87.       I have simulated a filter command as an example, so that novice dBASE
  88.       users might better understand the syntax.
  89.       
  90.       If you are unsure what syntax to use then leave the filter command
  91.       blank.  When you are done press ENTER to process the filter.
  92.  
  93. INDEX STATEMENT:
  94.       After you have processed your filter you are presented with the 
  95.       "Index Statement:" prompt.  This allows you to set up an index to
  96.       organize the records output to the merge file.  You must use
  97.       legitimate dBASE IV syntax for the index command.  An index with
  98.       more than a single field must be of the same field type.  In other 
  99.       words you cannot mix numeric and character fields without first
  100.       converting the numeric field to a character string.  
  101.       
  102.       I have simulated an index statement as an example, so that novice 
  103.       dBASE users might better understand the syntax.
  104.       
  105.       If you are unsure what syntax to use then leave the index statement
  106.       blank.  When you are done press ENTER to process the index.
  107.       
  108. DIRECTORY PATH:
  109.       After you have processed your index statement you are presented with
  110.       the "Put MERGE.DAT In What Directory:" prompt.  The default is whatever
  111.       directory you started dBASE from, i.e. C:\DBASE\.  If this is the 
  112.       proper directory then just press ENTER, otherwise enter the path to
  113.       the directory you want.  I prefer to place the file in my C:\WP51\
  114.       directory.  Once you are done press ENTER.
  115.       
  116. If everything has been entered correctly then the program shows you at what 
  117. step of the merging process it is.  You will see several statements appear
  118. on the screen depending on the information you entered.  The following may
  119. appear on your screen:
  120.  
  121.    PLEASE WAIT - Indexing Database Records
  122.    PLEASE WAIT - Processing Database Records
  123.    PLEASE WAIT - Converting [FIELDNAME] To Correct Case Using PROPER() U.D.F.
  124.    PLEASE WAIT - Creating Merge File
  125.       
  126. If everything was processed correctly and no errors were encountered then the
  127. the program displays the following message:
  128.  
  129.                   *******************************************
  130.                   **********  MERGE FILE CREATED  ***********
  131.                   *******************************************
  132.                         MAKEMRG.PRG by Michael A. Huber
  133.                   P.O. Box 501511, Indianapolis,IN 46250-6511
  134.  
  135. If the program was unable to correctly process the merge file because of an
  136. error in the information that was entered then the following message is 
  137. displayed along with a brief description of the error that occurred:
  138.  
  139.                   *******************************************
  140.                   **********  MERGE FILE CREATION  **********
  141.                   **********        FAILED         **********
  142.                   ******************************************* 
  143.                         MAKEMRG.PRG by Michael A. Huber
  144.                   P.O. Box 501511, Indianapolis,IN 46250-6511
  145.  
  146.  
  147.                        ERROR NO.  35 Unterminated String
  148. USER DEFINED FUNCTION:
  149.       Included at the end of the MAKEMRG program is a User Defined Function
  150.       called PROPER().  This function was developed to convert any upper, 
  151.       lower or combined upper and lower case string to its' proper case.  The
  152.       problem is some strings have different sets of criteria i.e. "McQuick",
  153.       "O'Grady", "R.R. #3 Box 59", etc.  These case conventions have been
  154.       taken into consideration with the PROPER() function.  I have tested 
  155.       this function and have not found too many problems other than the 
  156.       following:
  157.  
  158.        1) Because it is looking for the convention "Mc" within the string
  159.        it looks at the current character position minus 2 to see if it 
  160.        should capitalize the next character.  This is OK everywhere else
  161.        but positions 1 and 2.  Positions 1 and 2 will cause a dBASE #62 
  162.        error since the resulting position will either be a negative number
  163.        or will equal 0.  What dBASE does in this situation is to substitute
  164.        position 1 as the starting position which is exactly what is 
  165.        necessary to check for the convention "Mc" anyway.  I am sure that
  166.        this problem could easily be resolved, but "hay, if it works why
  167.        worry about it."
  168.        
  169.        2) If used in a program like MAKEMRG it cannot tell if the string
  170.        should be converted or not, simply based on the string itself.  An
  171.        example of this is a two character STATE field or a character field
  172.        with all non-alphabetic characters (like SSN "999-99-9999") probably
  173.        should not be converted.  I have restricted MAKEMRG from converting
  174.        a field which is named STATE.  If your STATE field is named something
  175.        different or your STATE field contains the full state name, you will
  176.        probably want to modify MAKEMRG accordingly.  As for the all non-
  177.        alphabetic character strings, MAKEMRG goes ahead and processes the 
  178.        string since the result is the same as the original string anyway.
  179.        
  180.        3) The last problem is not so much the function of PROPER() as it is
  181.        the dreaded inconsistent data entry person.  This function obviously
  182.        is not intelligent enough to take everything into consideration, 
  183.        especially inconsistent data.  An example of what I have seen is as
  184.        follows:
  185.        
  186.        ORIGINAL                         RESULT
  187.        
  188.        R.R. #3 BOX 510                  R.R. #3 Box 510            Ok
  189.        RR #3 BOX 510                    Rr #3 Box 510              Wrong
  190.        127 SOUTH 7TH STREET             127 South 7th Street Ok
  191.        127 SOUTH 7 TH STREET            127 South 7 Th Street      Wrong
  192.  
  193. STAND ALONE FUNCTION PROPER():
  194.        To use this function from the dot prompt you must first remove it
  195.        from MAKEMRG.PRG.  To do this follow these steps:
  196.        
  197.        Start dBASE
  198.        .                          (dBASE dot prompt)
  199.        . MODI COMM MAKEMRG        (dBASE editor)
  200.          PgDn                     (To the bottom of the program)
  201.                                   (Locate "FUNCTION Proper")
  202.                                   (Move the cursor to the line above
  203.                                    "FUNCTION Proper")
  204.          F6                       (Press F6 to begin block)
  205.                                   (Move the cursor down to the line 
  206.                                    below "RETURN m_Str")
  207.          ENTER                    (Press ENTER to end block)
  208.          CTRL-KW                  (Hold the CTRL key down and press 
  209.                                    the "K" key and then the "W" key)
  210.          PROPER.PRG               (Enter the filename to be saved)
  211.          ENTER                    (Press ENTER to save the file)
  212.          ESC                      (Press ESC to un-block the text)
  213.          ESC                      (Press ESC to exit the editor)
  214.          YES                      (Answer YES to the Exit prompt)
  215.        
  216. TO USE FUNCTION PROPER():
  217.        After you have created the file called PROPER.PRG you are ready to
  218.        use the function in many different ways. The following command must
  219.        be used to identify the procedure file to search.
  220.        
  221.              . SET PROCEDURE TO PROPER
  222.              
  223.        Here are some sample uses and the correct syntax to use for this
  224.        function:
  225.        
  226.        REPLACE ALL [fieldname] WITH PROPER([fieldname])
  227.        @ [row],[col] SAY PROPER([feildname/memvar])
  228.        ? PROPER([fieldname/memvar])
  229.  
  230.